#include <bits/stdc++.h>
using namespace std;
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
using ll = long long;
int a[1000000];
void solve()
{
    //这是一个等差数列
    //1~p
    ll d,p;
    cin >> d >> p;
    ll q;
    cin >> q;
    while(q--)
    {
        ll l, r;
        cin >> l >> r;
        cin >> l >> r;
        if(l)
    }

}
int main()
{
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}
